from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone

class KucunPost(models.Model):
    # author = models.ForeignKey(User,on_delete=models.CASCADE)
    chengpin_num = models.IntegerField(null=True)
    ban_num = models.IntegerField(null=True)
    green_num = models.IntegerField(null=True)
    red_num = models.IntegerField(null=True)
    yellow_num = models.IntegerField(null=True)
    dianzu_num = models.IntegerField(null=True)
    erjiguan_num = models.IntegerField(null=True)

    class Meta:
        ordering = ('id',)#元组，别忘了逗号

    def __str__(self):
        return self.chengpin_num

class ZhizuoPost(models.Model):
    zhizuo_name = models.CharField(max_length=100,null=True)
    han_green_num = models.IntegerField(null=True)
    han_yellow_num = models.IntegerField(null=True)
    han_red_num = models.IntegerField(null=True)
    han_total_num = models.IntegerField(null=True)
    cha_num = models.IntegerField(null=True)
    jian_num = models.IntegerField(null=True)
    
    class Meta:
        ordering = ('id',)

    def __str__(self):
        return self.zhizuo_name

class LingquPost(models.Model):
    chuku_date = models.DateField(default=timezone.now,null=True)
    lingqu_name = models.CharField(max_length=100,null=True)
    lingqu_num = models.IntegerField(null=True)

    class Meta:
        ordering = ('id',)

    def __str__(self):
        return self.lingqu_name

class ZhizuoNote(models.Model):
    new_name = models.CharField(max_length=100,null=True)
    new_date = models.DateField(default=timezone.now,null=True)
    new_green_num = models.IntegerField(null=True)
    new_yellow_num = models.IntegerField(null=True)
    new_red_num = models.IntegerField(null=True)
    new_total_num = models.IntegerField(null=True)
    new_cha_num = models.IntegerField(null=True)
    new_jian_num = models.IntegerField(null=True)